package fr.jfc.serveur;

import java.awt.*;
import java.awt.image.*;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.rmi.RemoteException;

import javax.imageio.ImageIO;

import net.sf.hibernate.HibernateException;

public class AfficheImage extends Frame{
    private Image image;

    public AfficheImage() throws HibernateException, IOException {
       setTitle("AfficheImage");
       setLocation(50,100);
       setSize(1000,1000);
    
       Utilitaire util=new Utilitaire();
       
       
       byte[] b=util.imageToByte("dupont");
       InputStream in = new ByteArrayInputStream(b);
    
       image=ImageIO.read(in);

       MediaTracker track = new MediaTracker(this);

       // 0 est l'identifiant de l'image a charger
       track.addImage(image, 0);

       try {
          track.waitForID(0);
       } catch (InterruptedException e) {}

     setVisible(true);
    }

    public void paint(Graphics g) {
        g.drawImage(image,50,50, null);
    }

    public static void main(String [] arg) throws HibernateException, IOException {
        new AfficheImage();
    }
}